<template>
    <div class="dialog">
      <div class="dialog-con conStockInfo">

        <p>确认入库</p>
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="90px" class="demo-ruleForm" label-position="right">
          <el-form-item label="商品名称">
            <el-input v-model="itemData.itemSkuName" disabled></el-input>
          </el-form-item>
           <el-form-item label="入库数量" prop="inNum">
                  <el-input v-model="ruleForm.inNum"></el-input>
            </el-form-item>
          <el-form-item label="破损数量" prop="brokenNum">
            <el-input v-model="ruleForm.brokenNum"></el-input>
          </el-form-item>
          <el-form-item label="入库仓库" prop="depotCode">
            <el-select v-model="ruleForm.depotCode" placeholder="请选择"  filterable allow-create>
              <el-option
                v-for="item in stockIn"
                :key="item.id"
                :label="item.depotName"
                :value="item.depotName">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="btn">
            <el-button @click="submitForm('ruleForm')" type="success"  size="medium">提交</el-button>
            <el-button @click="cancel" type="success" plain size="medium">取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
</template>

,
document.onmouseup=function(){
document.onmousemove=null;
document.onmouseup=null;
};
<script>

    export default {
       data(){
         return {
           stockIn:[],
           ruleForm:{
             depotCode:"",
             inNum:'',
             brokenNum:''
           },
           rules:{
             depotCode: [
               { required: true, message: '请选择仓库名称', trigger: 'blur' }
             ],
             inNum: [
               {required: true, message: '请输入入库数量', trigger: 'change' }
             ],
             brokenNum: [
               {required: true, message: '请输入破损数量', trigger: 'change' }
             ],
           }
         }
       },
      props:{
        itemData:{}
      },
      created() {
        this.getWareHouse()

      },
      methods:{
        //获取仓库
        getWareHouse(){
          let success=data=>{
            if(data.code=="OK"){
              this.stockIn=data.data;
            }else{
              this.$message.error(data.msg)
            }
          }
          this.api.erpComplainDepotListAll({},success)
        },
        cancel(){
          this.$emit("close")
        },
        submitForm(formName) {
          this.$refs[formName].validate((valid) => {
            if (valid) {
              this.confirm()
            } else {
              return false;
            }
          });
        },
        confirm(){
          this.ruleForm['itemId']=this.itemData.itemId
          this.ruleForm['itemSkuName']=this.itemData.itemSkuName
          this.$emit("close",this.ruleForm)
        }
      }
    }
</script>

<style scoped lang="scss">
.conStockInfo{
  width:400px;
  height:350px;
  p{
    line-height:45px;
    text-indent: 20px;
    color:#4FA1D9;
  }
  .el-input{
    width:80%;
  }
  .el-select{
    width:80%;
  }
  .btn{
    width:300px;
    text-align: center;
  }
}
</style>
